package com.kika.obwiki.controller;

import com.kika.obwiki.service.IContentService;
import com.kika.obwiki.resp.CommonResp;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author cr
 * @since 2025-06-22
 */
@RestController
@RequestMapping("/content")
public class ContentController {

  @Autowired
  private IContentService contentService;

  /**
   * 根据文档ID查询内容
   * 
   * @param id 文档ID
   * @return 文档内容字符串
   */
  @GetMapping("/findContent/{id}")
  public CommonResp<String> findContent(@PathVariable Long id) {
    CommonResp<String> resp = new CommonResp<>();
    String content = contentService.findContent(id);
    resp.setContent(content);
    return resp;
  }
}
